package com.gcms;

/**
 * @ClassName FactoryPattern
 * @Description TODO
 * @Author 2214361854
 * @Date 2022/3/5 22:22
 * @Version 1.0
 */
public class FactoryPattern {
    public static Coumputer createComputer(String info){
        switch (info){
            case "huawei":
                Coumputer ch = new Huawei();
                ch.setName("huawei pro 16");
                ch.setPrice(5999);
                return ch;
            case "mac":
                Coumputer cm = new Mac();
                cm.setName("MacBook pro");
                cm.setPrice(11999);
                return cm;
            default:
            return null;
        }
    }
}
